package com.zhuhjay.chat.client.handler;

import com.zhuhjay.chat.message.GroupMembersResponseMessage;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;

/**
 * 群组用户响应消息处理器
 * @author ZhuHJay
 * @date 2023/3/9 11:37
 */
@ChannelHandler.Sharable
public class GroupMembersResponseMessageHandler extends AbstractResponseMessageHandler<GroupMembersResponseMessage> {
    @Override
    protected void channelRead0(ChannelHandlerContext ctx, GroupMembersResponseMessage msg) throws Exception {
        if (msg.getReason() == null) {
            System.out.printf("\r群成员: %s%n>>> ", String.join(",", msg.getMembers()));
        } else {
            System.out.printf("\rERROR: %s%n>>> ", msg.getReason());
        }
    }
}
